//数量金额明细账动态列

var columns = function(mode){
    var cols = [{
        title:'日期',
        width:120,
        field:'buname'
    }, {
        title:'凭证字号',
        field:'buname',
        align:'left',
        width:120
    }, {
        title:'摘要',
        field:'buname',
        align:'left',
        width:'auto'
    }, {
        title:'单位',
        field:'buname',
        align:'left',
        width:'8%'
    }, {
        title:'数量',
        field:'buname',
        align:'right',
        width:'8%'
    }, {
        title:'单价',
        field:'buname',
        align:'right',
        width:'8%'
    }];

    //数量外币式
    if(mode == '1'){
        cols = cols.concat([
            {
                title:'借方外币',
                field:'buname',
                align:'right',
                width:'8%'
            }, {
                title:'贷方外币',
                field:'buname',
                align:'right',
                width:'8%'
            }, {
                title:'方向',
                field:'buname',
                className:'bdlr',
                align:'center',
                width:50,
                filter:function(){
                    return '借'
                }
            }, {
                title:'余额',
                field:'buname',
                className:'bdlr',
                width:'24%',
                children:[{
                    title:'数量',
                    field:'buname',
                    align:'right',
                    className:'bdtlr',
                    width:'8%'
                }, {
                    title:'单价',
                    field:'buname',
                    align:'right',
                    className:'bdtlr',
                    width:'8%'
                }, {
                    title:'外币',
                    field:'buname',
                    align:'right',
                    className:'bdtlr',
                    width:'8%'
                }]
            }
        ])
    }

    //数量金额式
    else{
        cols = cols.concat([
            {
                title:'借方金额',
                field:'buname',
                align:'right',
                width:'8%'
            }, {
                title:'贷方金额',
                field:'buname',
                align:'right',
                width:'8%'
            }, {
                title:'方向',
                field:'buname',
                className:'bdlr',
                align:'center',
                width:50,
                filter:function(){
                    return '借'
                }
            }, {
                title:'余额',
                field:'buname',
                className:'bdlr',
                width:'24%',
                children:[{
                    title:'数量',
                    field:'buname',
                    align:'right',
                    className:'bdtlr',
                    width:'8%'
                }, {
                    title:'单价',
                    field:'buname',
                    align:'right',
                    className:'bdtlr',
                    width:'8%'
                }, {
                    title:'金额',
                    field:'buname',
                    align:'right',
                    className:'bdtlr',
                    width:'8%'
                }]
            }
        ])
    }

    return cols
}

return columns